home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Format CD 49
/
Amiga Format CD49 (2000-01-17)(Future Publishing)(GB)(Track 1 of 3)[!][issue 2000-02].iso
/
-serious-
/
misc
/
football
/
user
/
matchesplayed.rexx
< prev
next >
Wrap
OS/2 REXX Batch file
|
1999-11-29
|
8KB
|
296 lines
/* Mode=Set */
/* ***********************************************************************
MATCHES PLAYED PROGRAM FOR FOOTBALL REXX SUITE
------------------------------------------------
Copyright Mark Naughton 1997
Version Date History
--------------------------------------------------------------------------
1.0 050197 First release.
060197 Added check so that it exits if the teams play each
other more than twice.
110197 Forgot to initialise the variable used above. Name
changed from 'GamesToBePlayed' to 'GamesPlayed'.
110197 Now shows all games played by selected team.
170197 Fixed bug where it displayed the team selected
instead of skipping it.
151297 Now shows selected team's score first in Away matches
as well. Tidied display.
210499 Added check for no team specified.
1.1 150599 Name change. Started adding support for other types
of playing each team - from 1 to 10; all works ok.
250899 Added error msg for file checks.
110999 Converted to use locale. Some error messages, before
reading the locale, will still be in English.
**************************************************************************
Procedure
---------
1. Check files exist. Read Teams.df datafile and store teams.
3. Open Schedule datafile.
4. Use selected team against either HOME or AWAY team and store the score
if a match has been played. Otherwise increment matches_to_play.
5. Close file. Display data then exit...
************************************************************************** */
PARSE ARG league_stuff
version = 1
input_file = '.df'
input2_file = '.sf'
title = '*LEAGUE_NAME='
playeo = '*PLAY_OTHER='
separator = '*'
teams. = '???'
teams2. = '???'
counter = 0
not_played = '__ __'
home. = '???'
away. = '???'
matches. = '???'
numplay = 2
oddn = '1 3 5 7 9'
evenn = '2 4 6 8 10'
parse var league_stuff league_file search_team
league_file = "Data/" || league_file
if open(datafile,"Data/Football.locale",'r') then do
line = readln(datafile)
locdir = strip(line)
close(datafile)
end
else do
say
say "ERROR : (MatchesPlayed)"
say
say "Cannot read 'Data/Football.locale' for the locale settings."
exit
end
locdir = locdir"User/MatchesPlayed.data"
if open(datafile,"ENV:FootballRXPath",'r') then do
line = readln(datafile)
rxdir = strip(line)
close(datafile)
end
else
rxdir = "SYS:Rexxc/"
if exists(locdir) > 0 then do
address command rxdir'rx 'locdir
VarCount = getclip('VarCount')
do i = 1 to VarCount
interpret getclip('var.'i)
end
end
else do
say
say "ERROR : (MatchesPlayed)"
say
say "Cannot find '"locdir"' to read locale settings."
exit
end
if exists(league_file || input_file) = 0 then do
say
say mp_error
say
say mp_t1"'"league_file || input_file"'."
exit
end
if exists(league_file || input2_file) = 0 then do
say
say mp_error
say
say mp_t1"'"league_file || input2_file"'."
exit
end
if search_team = "" then do
say
say mp_error
say
say mp_t4
say
say mp_t5
say
exit
end
if open(datafile,league_file || input_file,'r') then do
do while ~eof(datafile)
line = readln(datafile)
if pos(title,line) > 0 then
league_title = delstr(line,1,13)
if pos(playeo,line) > 0 then
numplay = delstr(line,1,12)
if pos(separator,line) = 0 then do
line = strip(line)
if counter = 0 then do
teams.1 = line
counter = 1
end
else do
counter = counter + 1
teams.counter = line
end
end
end
close(datafile)
maxplay = numplay
do i=1 to words(oddn)
if numplay = word(oddn,i) then
maxplay = word(evenn,i)
end
if numplay < 3 then inftle = mp_t6
if numplay > 2 & numplay < 5 then inftle = mp_t7
if numplay > 4 & numplay < 7 then inftle = mp_t8
if numplay > 6 & numplay < 9 then inftle = mp_t9
if numplay > 8 then inftle = mp_t10
do i=1 to counter
if numplay < 5 then do
matches.i = "**-** **-**"
if numplay > 2 then
matches.i = matches.i" **-** **-**"
end
else do
matches.i = "**-** **-** **-** **-** **-** **-**"
if numplay=7 | numplay = 8 then
matches.i = matches.i" **-** **-**"
if numplay > 8 then
matches.i = matches.i" **-** **-** **-** **-**"
end
end
sel=-1
search_team = strip(search_team)
do i=1 to counter
if pos(search_team,teams.i) > 0 then
sel = i
end
i = 0
mtp = 0
if sel > 0 then do
if open(datafile,league_file || input2_file,'r') then do
do while ~eof(datafile)
line = readln(datafile)
if pos(separator,line) = 0 then do
home_team = strip(substr(line,1,30))
goals_for = strip(substr(line,32,2))
goals_aga = strip(substr(line,37,2))
away_team = strip(substr(line,41,30))
strng = strip(teams.sel)
if strng = home_team then do
do i=1 to counter
if away_team = teams.i then do
do ah=1 to maxplay by 2
if word(matches.i,ah) = "**-**" then do
wi = wordindex(matches.i,ah)
if pos(not_played,line) > 0 then
matches.i = overlay(".....",matches.i,wi,5)
else do
matches.i = overlay(right(goals_for,2,' ')||mp_t17||left(goals_aga,2,' '),matches.i,wi,5)
mtp = mtp + 1
end
leave
end
end
end
end
end
if strng = away_team then do
do i=1 to counter
if home_team = teams.i then do
do ah=2 to maxplay by 2
if word(matches.i,ah) = "**-**" then do
wi = wordindex(matches.i,ah)
if pos(not_played,line) > 0 then
matches.i = overlay(".....",matches.i,wi,5)
else do
matches.i = overlay(right(goals_aga,2,' ')||mp_t17||left(goals_for,2,' '),matches.i,wi,5)
mtp = mtp + 1
end
leave
end
end
end
end
end
end
end
close(datafile)
end
else do
say
say mp_error
say
say mp_t2"'"league_file || input2_file"'"mp_t3
exit
end
do i=1 to counter
if sel ~= i then do
do k=1 to words(matches.i)
if word(matches.i,k) = "**-**" then do
wi = wordindex(matches.i,k)
matches.i = overlay(" ",matches.i,wi,5)
end
end
end
end
say
say center(mp_t11"'"league_title"'",78)
und = "-------------------------------------------------------------------------------"
say und
say
say mp_t12": "teams.sel" "mp_t13
say
say
say
inftle = inftle" "mp_t12
itf = length(und) - 4
under = left("-",itf,'-')
say " "inftle
say " "under
do i=1 to counter
if sel ~= i then
say " "matches.i" "teams.i
end
say
say
say
say " "mp_t14""mtp
say
say
say "-------------------------------------------------------------------------------"
say
end
else do
say
say mp_error
say
say mp_t15" '"search_team"' "mp_t16
exit
end
end
else do
say
say mp_error
say
say mp_t2"'"league_file || input_file"'"mp_t3
end
exit